Feat/yaml typespec support - #8
Merged
Artifizer merged 2 commits intoNov 22, 2025
Merged
Conversation
- Renamed JsonFile → GtsFile - Renamed JsonEntity → GtsEntity - Renamed JsonPathResolver → GtsPathResolver - Renamed JsonEntityCastResult → GtsEntityCastResult - Added backward compatibility aliases in __init__.py - Updated all imports and type annotations across codebase BREAKING CHANGE: Class names changed from Json* to Gts*. Backward compatibility aliases provided for smooth migration.
- Added PyYAML dependency (pyyaml>=6.0,<7) - Extended file reader to support .yaml and .yml extensions - Implemented format-aware file loading (YAML vs JSON) - Updated all class references in files_reader.py to use Gts* names - Added comprehensive format support documentation - Documented TypeSpec pre-compilation workflow YAML files are automatically detected and parsed. TypeSpec requires external compilation to JSON Schema before use.
Artifizer
approved these changes
Nov 22, 2025
| npm install -g @typespec/compiler @typespec/json-schema | ||
|
|
||
| # Compile TypeSpec to JSON Schema | ||
| tsp compile --emit @typespec/json-schema your-schemas/ |
Contributor
There was a problem hiding this comment.
We'd like to have *.tsp files support right in the _load_file() and avoid this pre-processing. Could you please add it as separate PR?
KvizadSaderah
added a commit
to KvizadSaderah/gts-python
that referenced
this pull request
Dec 12, 2025
Adds automatic compilation of TypeSpec files to JSON Schema: - Added .tsp to valid_extensions for file discovery - Created _compile_tsp() method using subprocess to call tsp compiler - Falls back to npx @typespec/compiler if tsp not in PATH - Gracefully skips .tsp files if compiler not available - Updated README with native TypeSpec documentation Requires: npm install -g @typespec/compiler @typespec/json-schema Closes request from PR GlobalTypeSystem#8 review
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Renames
Json*classes toGts*and adds YAML/TypeSpec support.Changes
1. Class Renaming:
JsonFile→GtsFile,JsonEntity→GtsEntity,JsonPathResolver→GtsPathResolver,JsonEntityCastResult→GtsEntityCastResult2. YAML Support:
.yamland.ymlfiles3. TypeSpec:
Testing
✅ All tests passed - YAML loading, JSON regression, backward compatibility confirmed
Files Changed
9 files, ~140 lines, 100% backward compatible